﻿@using Csla.Web.Mvc
@using ProjectTracker.Library

@model IEnumerable<ProjectTracker.Library.ProjectInfo>

@{
    ViewBag.Title = "Project list";
}

<h2>@ViewBag.Message</h2>

    <p>
      @Html.HasPermission(Csla.Rules.AuthorizationActions.CreateObject, typeof(ProjectEdit), Html.ActionLink("Create New", "Create"), string.Empty)
    </p>
    <table>
        <tr>
            <th></th>
            <th>
                Name
            </th>
        </tr>
    
    @foreach (var item in Model) {
        <tr>
            <td>
                @Html.HasPermission(Csla.Rules.AuthorizationActions.EditObject, typeof(ProjectEdit), Html.ActionLink("Edit", "Edit", new { id = item.Id }), "Edit") |
                @Html.ActionLink("Details", "Details", new { id=item.Id }) |
                @Html.HasPermission(Csla.Rules.AuthorizationActions.DeleteObject, typeof(ProjectEdit), Html.ActionLink("Delete", "Delete", new { id = item.Id }), "Delete")
            </td>
            <td>
                @item.Name
            </td>
        </tr>
    }
    
    </table>
